package com.it.arktech;

import java.util.List;
import java.util.Locale;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.it.arktech.model.Member;
import com.it.arktech.repository.MemberRepository;

/**
 * @author LeeCom
 *
 */
@Controller
public class ServicesController {
	
	@Autowired
	MemberRepository memberRepository;
	
	private static final Logger logger = LoggerFactory.getLogger(ServicesController.class);
	
	@RequestMapping(value = "/person", method = RequestMethod.GET)
	public String person(Locale locale, Model model) {
		try{
			List<Member> findList =  memberRepository.findAllMember();
			if(findList == null)return "404";
			model.addAttribute("member", findList);
		}catch(Exception e){
			e.printStackTrace();
		}
		
		
		logger.info("Welcome person! The client locale is {}.", locale);
		return "section/person";
	}
	@RequestMapping(value = "/stock", method = RequestMethod.GET)
	public String stock(Locale locale, Model model) {
		logger.info("Welcome stock! The client locale is {}.", locale);
		return "section/stock";
	}
	@RequestMapping(value = "/mail", method = RequestMethod.GET)
	public String mail(Locale locale, Model model) {
		logger.info("Welcome mail! The client locale is {}.", locale);
		return "section/mail";
	}
	@RequestMapping(value = "/ftp", method = RequestMethod.GET)
	public String ftp(Locale locale, Model model) {
		logger.info("Welcome ftp! The client locale is {}.", locale);
		return "section/ftp";
	}
	

}
